package com.adjy.pathbuilders.database;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class GameDatabaseOpenHelper extends SQLiteOpenHelper  {
	private static final int DATABASE_VERSION = 42;
	private static final String DATABASE_NAME = "pathbuilders_db";
	
	private static final String LEVEL_TABLE_CREATE =
			"CREATE TABLE " + GameDatabase.LEVEL_TABLE_NAME + " (" +
			GameDatabase.KEY_LEVEL_ID + " TEXT PRIMARY KEY, " +
			GameDatabase.KEY_LEVEL_ENABLED + " BOOLEAN, " +
			GameDatabase.KEY_LEVEL_COINS + " INTEGER, " +
			GameDatabase.KEY_LEVEL_TIME + " INTEGER);";
	
	private static final String AUDIO_TABLE_CREATE =
			"CREATE TABLE " + GameDatabase.AUDIO_TABLE_NAME + " (" +
				GameDatabase.KEY_AUDIO_VOLUME + " INTEGER PRIMARY KEY, " +
				GameDatabase.KEY_AUDIO_MUTED + " INTEGER);";
	
	

    public GameDatabaseOpenHelper(Context context) {
        super(context, DATABASE_NAME, null, DATABASE_VERSION);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
    	db.execSQL(LEVEL_TABLE_CREATE);
    	db.execSQL(AUDIO_TABLE_CREATE);
    }

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		// TODO Auto-generated method stub
	}
	
	@Override
	public void onOpen(SQLiteDatabase db) {
		super.onOpen(db);
	}
}
